<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
        //执行用户分析统计命令
        $schedule->command('wxtj-user:summary')->daily('01:00')->withoutOverlapping();
        $schedule->command('wxtj-user:cumulate')->daily('01:00')->withoutOverlapping();
        //执行接口分析统计命令
        $schedule->command('wxtj-interface:summary')->dailyAt('01:30')->withoutOverlapping();
        $schedule->command('wxtj-interface:summary')->dailyAt('01:30')->withoutOverlapping();
        //执行消息分析统计命令
        $schedule->command('wxtj-upstream:msg')->dailyAt('02:00')->withoutOverlapping();
        $schedule->command(' wxtj-upstream:msg-hour')->dailyAt('02:10')->withoutOverlapping();
        $schedule->command('wxtj-upstream:msg-week')->dailyAt('02:20')->withoutOverlapping();
        $schedule->command('wxtj-upstream:msg-month')->dailyAt('02:30')->withoutOverlapping();
        $schedule->command('wxtj-upstream:msg-dist')->dailyAt('02:40')->withoutOverlapping();
        $schedule->command('wxtj-upstream:msg-dist-week ')->dailyAt('02:50')->withoutOverlapping();
        $schedule->command('wxtj-upstream:msg-dist-month')->dailyAt('02:50')->withoutOverlapping();
        //执行图文分析统计命令
        $schedule->command('wxtj-article:summary')->dailyAt('03:00')->withoutOverlapping();
        $schedule->command('wxtj-article:total')->dailyAt('03:10')->withoutOverlapping();
        $schedule->command('wxtj-article:user-read')->dailyAt('03:20')->withoutOverlapping();
        $schedule->command('wxtj-article:user-read-hour')->dailyAt('03:40')->withoutOverlapping();
        $schedule->command('wxtj-article:user-share')->dailyAt('03:50')->withoutOverlapping();
        $schedule->command('wxtj-article:user-share-hour')->dailyAt('03:50')->withoutOverlapping();
        //TODO::抓取客服消息
        //TODO::定时群发消息
        $schedule->command('wx-mass:delayed-send')->everyMinute()->withoutOverlapping();
        //TODO::抓取群发评论消息

        //已经领取会员卡的会员数据定时刷新
        //$schedule->command('sfy-member:refresh')->hourly()->between('8:00', '22:00')->withoutOverlapping();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');
        //注册微信微信相关命令
        $this->load(__DIR__.'/WxCommands');
        //注册微信统计命令
        $this->load(__DIR__.'/WxtjCommands');

        require base_path('routes/console.php');
    }
}
